package cc.yugu.yhdw.common.protocol.msg02;

import cc.yugu.yhdw.common.protocol.MsgCode;
import cc.yugu.yhdw.common.tool.netty.TypeOperator;
import io.netty.buffer.ByteBuf;

import java.util.ArrayList;
import java.util.List;

public class Msg022000031 extends Msg022 {
    public List<Coordinate> coordinateList = new ArrayList<Coordinate>();

    @Override
    public int getMsgCode() {
        return MsgCode.MSG_022000031.getCode();
    }

    @Override
    public void writeData(ByteBuf buffer) {
        writeRtn(buffer);

        buffer.writeInt(coordinateList.size());
        for (Coordinate e : coordinateList) {
            e.write(buffer);
        }
    }

    public static class Coordinate extends TypeOperator {

        public double lng;
        public double lat;
        public long reportTime;

        public void write(ByteBuf buffer) {
            buffer.writeDouble(lng);
            buffer.writeDouble(lat);
            buffer.writeLong(reportTime);
        }
    }
}
